import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';

//查询日历
export const queryYearsCalender = (params) => {
  params.head.transCode = 'queryYearsCalender';
  return request({
    url: '/platform/sysCalender/queryYearsCalender',
    method: 'post',
    data: params
  })
}
//单条查询
export const querySysCalender = (params) => {
  params.head.transCode = 'querySysCalender';
  return request({
    url: '/platform/sysCalender/querySysCalender',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const querySysCalenderListPage = (params) => {
  params.head.transCode = 'querySysCalenderListPage';
  return request({
    url: '/platform/sysCalender/querySysCalenderListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysCalender = (params) => {
  params.head.transCode = 'saveSysCalender';
  return request({
    url: '/platform/sysCalender/saveSysCalender',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveSysCalenderList = (params) => {
  params.head.transCode = 'saveSysCalenderList';
  return request({
    url: '/platform/sysCalender/saveSysCalenderList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysCalender = (params) => {
  params.head.transCode = 'saveOrUpdateSysCalender';
  return request({
    url: '/platform/sysCalender/saveOrUpdateSysCalender',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysCalenderList = (params) => {
  params.head.transCode = 'saveOrUpdateSysCalenderList';
  return request({
    url: '/platform/sysCalender/saveOrUpdateSysCalenderList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysCalender = (params) => {
  params.head.transCode = 'updateSysCalender';
  return request({
    url: '/platform/sysCalender/updateSysCalender',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteSysCalender = (params) => {
  params.head.transCode = 'deleteSysCalender';
  return request({
    url: '/platform/sysCalender/deleteSysCalender',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysCalenderList = (params) => {
  params.head.transCode = 'deleteSysCalenderList';
  return request({
    url: '/platform/sysCalender/deleteSysCalenderList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportSysCalenderExcel = (params) => {
  downloadExcel({
    url: '/platform/sysCalender/excelDownload/exportSysCalenderExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
